﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Security.Principal;


using ComLib;
using ComLib.Authentication;
using ComLib.Web.Lib.Models;


namespace ComLib.Web.Lib.Helpers
{
    public class PostHelper
    {
        public static PostActionsViewModel BuildActions(bool hasComments, int commentCount, int postId, string postTitle, HttpContext ctx)
        {
            // Build  http://localhost:49739/post/Details/14
            // from : http://localhost:49739/post/index
            string permaLink = HttpContext.Current.Request.Url.AbsolutePath;
            permaLink = permaLink.ToLower().Replace("/index", "/details/" + postId);
            string emailBody = "Thought you might like this : " + postTitle + ".";
            emailBody += " " + ctx.Request.Url.AbsoluteUri;
            PostActionsViewModel model = new PostActionsViewModel(hasComments, commentCount, permaLink, permaLink, postTitle, emailBody);
            return model;
        }
    }
}
